package com.hc.concurrent_likes.utils;

import java.time.LocalDate;
import java.time.LocalTime;
import java.util.Calendar;
import java.util.GregorianCalendar;

/**
 * 描述：时间工具类
 * @author JXR
 * @date 2022/11/16
 */
public class TimeUtils {

    public static Calendar calendar = new GregorianCalendar();

    /**
     * 获取当前时间
     * @return 当前时间
     */
    public static String getCurrentTime(){
        LocalDate date = LocalDate.now();
        LocalTime time = LocalTime.now();
        int index = (date + " " + time).indexOf(".");
        return (date + " " + time).substring(0, index);
    }

//    public static void main(String[] args) {
//        System.out.println(TimeUtils.getCurrentTime());
//    }
}
